package Demo;

import java.util.concurrent.BlockingQueue;

public class ConsumerQueue implements Runnable{

    private BlockingQueue<Goods> blockingQueue;
    private Object object;


    public ConsumerQueue(BlockingQueue<Goods> blockingQueue) {
        this.blockingQueue = blockingQueue;
    }

    public ConsumerQueue() {
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public BlockingQueue<Goods> getBlockingQueue() {
        return blockingQueue;
    }

    public void setBlockingQueue(BlockingQueue<Goods> blockingQueue) {
        this.blockingQueue = blockingQueue;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {

                    Goods goods = this.blockingQueue.take();
                    System.out.println("消费者消费了"+goods.getBrand()+"---"+goods.getName());

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }


    }
}
